﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using MeizuSDK.Presentation;
using MeizuSDK.Core;
using System.Threading;

namespace Demo
{
    class GravitySensorWindow : DemoWindowBase
    {
        Label label = new Label();
        Timer timer;

        public GravitySensorWindow()
        {
            label.Location = new Point(10, 80);
            Controls.Add(label);

            timer = new Timer(OnTimer, null, 0, 100);
        }

        void OnTimer(object state)
        {
            GravityData gd = GravitySensor.Instance.Data;
            label.Text = string.Format("X = {0}, Y = {1}, Z = {2}", gd.X, gd.Y, gd.Z);
        }

        protected override void Dispose(bool disposing)
        {
            if (timer != null)
                timer.Dispose();
            base.Dispose(disposing);
        }
    }
}
